package com.hxkj.utils;

import java.util.Calendar;

/**
 * @ClassName
 * @Description
 * @Author zhuzhengxin
 * @Date 2018/6/6 15:46
 * @Version 1.0
 */
public class DateFormatUtils {

    /**
     * 当前时间 +  month 个月
     * @param month
     * @return
     */
    public static Long dateFormatMonth(int month) {
        Calendar c = Calendar.getInstance();
        //目前时间+ month 个月
        c.add(Calendar.MONTH, -month);
        Long monthTime = c.getTimeInMillis();

        return monthTime;

    }


    /**
     * 获取指定天数以前的时间毫秒数
     * @param day
     * @return
     */
    public static Long getMillisecondsBeforeDay(int day) {
        long thisTime = System.currentTimeMillis();
        long timeInterval = 24 * 60 * 60 * 1000 * day;
        long oldTime = thisTime - timeInterval;
        return oldTime;

    }


}
